<include file="Public/head"/>
<include file="Public/common_header"/>
<div class="mian">
    <include file="Public/sidebar" menu="cwgl.djq"/>
    <div class="mianR">

        <h3 class="cha">代金券详情</h3>

        <div class="vouchers">
            <span class="vou-dangqian">
            <em>当前可用代金券：<b>{$stat.available_num|default="0"} </b>张</em>
            <em>当前代金券金额：<b>{$stat.cur_amount_sum|default="0"}</b>元</em>
            </span>
            <ul class="clearfix">
                <li class="vou-list1 clearfix">
                    <span>公司名称：{$detail.fullname}</span>
                    <span>100元代金券：<b>{$stat.amount_stat.100|default="0"}</b>张</span>
                    <span>本月即将到期的代金券：<b>{$stat.expiring|default="0"}</b>张</span>
                </li>
                <li class="vou-list2 clearfix">
                    <span>公司联系人：{$detail.contact_person}</span>
                </li>
                <li class="vou-list3 clearfix">
                    <span>500元代金券：<b>{$stat.amount_stat.500|default="0"}</b>张</span>
                </li>
            </ul>
        </div>
        <div class="yuyue">
            <ul>
                <input type="hidden" name="use_status" value="" />
                <li value="0" class="yuCurrent">未使用</li>
                <li value="1">已使用</li>
                <li value="2">已过期</li>
            </ul>
        </div>
        <div class="yuList">
            <div class="notused">
                    <div class="not-biaodan">
                        <div class="zhuang-tai zhuang-tai1">
                            <input type="text" name="coupon_type_id" data="" value="" placeholder="请选择代金券类型" class="obtain" readonly/>
                            <dl>
                                <dd class="coupon_type" value="">请选择代金券类型</dd>
                                <foreach name="coupon_type" item="item">
                                <dd value="{$item.coupon_type_id}">{$item.type_name}({$item.amount})</dd>
                                </foreach>
                            </dl>
                        </div>
                        <div class="zhuang-tai zhuang-tai2" style="width: 177px">
                            <input type="text" name="get_time" value="" placeholder="请选择获取时间" class="time-text" readonly/>
                        </div>
                        <div class="zhuang-tai zhuang-tai1">
                            <input type="text" name="end_date" value="" placeholder="请选择截止使用时间" class="time-text1" readonly/>
                        </div>
                        <div class="shangSou">
                            <input curr_tab="0" name="searchBtn" type="button" value="搜索"/>
                        </div>
                        <div class="clear"></div>
                    </div>
                    <h4 class="clearfix">
                        <em class="voucher">券号</em>
                        <em>金额</em>
                        <em class="voucher1">获取日期</em>
                        <em>获取方式</em>
                        <em class="voucher1">开始使用日期</em>
                        <em class="voucher2">截止使用日期</em>
                    </h4>
                </div>
        </div>
        <div id="listBox" class="listBox"></div>
        <div class="yongBtn1">
            <input type="button" value="关闭" class="quxiao" onclick="window.close()"/>
        </div>

    </div>
    <div class="clear"></div>
</div>
<div class="yunBei"></div>
<script>
get_page(1);
function get_page(p){
    p = typeof(p)=='undefined' ? '1' : p;
    var url = mkurl();
//    console.log(url)
    $.get(url, {'p':p}, function(data){
        $("#listBox").html(data);
    },"html");
}
$('.yuyue > ul li').click(function(){
    $('input[name=searchBtn]').attr('curr_tab',$(this).attr('value'));
    get_page(1)
});
$('.zhuang-tai1 dl dd').on('click',function(){
    $('input[name=coupon_type_id]').attr('data',$(this).attr('value'))
})
$('input[name=searchBtn]').on('click',function(){
    get_page(1);
});
function mkurl(){
    var url = '/Coupon/detail_list/dealer_id/{$Think.get.dealer_id}';
    var curr_tab = $('input[name=searchBtn]').attr('curr_tab');
        url += '/curr_tab/'+curr_tab;
    var coupon_type_id = $('input[name=coupon_type_id]').attr('data');
    if(coupon_type_id !=''){
        url += '/coupon_type_id/'+coupon_type_id;
    }
    var get_time = $('input[name=get_time]').val();
    if(get_time !=''){
        url += '/get_time/'+get_time;
    }
    var end_date = $('input[name=end_date]').val();
    if(end_date !=''){
        url += '/end_date/'+end_date;
    }
    return url;
}
$('.queding').on('click',function(){
    window.history.back(-1);
})
</script>
<script>
$(document).ready(function() {
    $(".time-text").ymdateplugin({
        changeMonth: true,
        changeYear: true
    });
    $(".time-text1").ymdateplugin({
        changeMonth: true,
        changeYear: true
    });


    $(".time-text").click(function(){
        $("#ui-datepicker-div").fadeIn();
        $("#ui-datepicker-div").append("<input type='button' value='清空' class='moren' onclick='moren(this)'>")
    })

    $(".time-text1").click(function(){
        $("#ui-datepicker-div").fadeIn();
        $("#ui-datepicker-div").append("<input type='button' value='清空' class='moren' onclick='moren1(this)'>")
    })
});

    var val_1=$(".time-text1").attr("placeholder");
    function moren1(ele){
        $(ele).parent().fadeOut();
        var val_2=val_1;
        console.log(val_2)
        $(".time-text1").val("")
        $(".time-text1").attr({"placeholder":val_2});
    }

    var val1=$(".time-text").attr("placeholder");
    function moren(ele){
        $(ele).parent().fadeOut();
        var val2=val1
        $(".time-text").val("")
        $(".time-text").attr("placeholder",val2);
    }

</script>


<include file="Public/foot" />